<!-- 即将到期的合同 -->
<template>
  <div class="contract-remind-container">
    <!-- 搜索工作栏 -->
    <ContentWrap class="search-wrapper">
      <div class="search-form-container">
        <el-form
          :model="queryParams"
          ref="queryFormRef"
          :inline="true"
          label-width="100px"
          label-position="left"
          class="enhanced-search-form"
        >
          <div class="form-row">
            <el-form-item label="到期状态" prop="expiryType" class="form-item">
              <el-select
                v-model="queryParams.expiryType"
                placeholder="状态"
                @change="handleQuery"
                class="enhanced-select"
              >
                <template #prefix>
                  <Icon icon="ep:warning" />
                </template>
                <el-option
                  v-for="(option, index) in CONTRACT_EXPIRY_TYPE"
                  :label="option.label"
                  :value="option.value"
                  :key="index"
                >
                  <div class="option-item">
                    <Icon icon="ep:timer" class="option-icon" />
                    <span>{{ option.label }}</span>
                  </div>
                </el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-form>
      </div>
    </ContentWrap>

    <!-- 列表区域 -->
    <ContentWrap class="table-wrapper">
      <div class="table-header">
        <div class="header-icon">
          <Icon icon="ep:list" />
        </div>
        <div class="header-content">
          <h4 class="table-title">合同列表</h4>
          <p class="table-subtitle">共 {{ total }} 个合同</p>
        </div>
      </div>

      <div class="table-container">
        <el-table
          v-loading="loading"
          :data="list"
          :show-overflow-tooltip="true"
          :stripe="true"
          class="enhanced-table"
          :header-cell-style="{ background: '#f8f9ff', color: '#303133', fontWeight: '600' }"
        >
          <el-table-column align="center" fixed="left" label="合同编号" prop="no" width="180">
            <template #default="scope">
              <div class="contract-no-cell">
                <Icon icon="ep:document" class="cell-icon" />
                <span class="contract-no-text">{{ scope.row.no }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" fixed="left" label="合同名称" prop="name" width="160">
            <template #default="scope">
              <div class="name-cell">
                <Icon icon="ep:document-copy" class="cell-icon" />
                <el-link
                  :underline="false"
                  type="primary"
                  @click="openDetail(scope.row.id)"
                  class="contract-link"
                >
                  {{ scope.row.name }}
                </el-link>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" label="客户名称" prop="customerName" width="120">
            <template #default="scope">
              <div class="customer-cell">
                <Icon icon="ep:user" class="cell-icon" />
                <el-link
                  :underline="false"
                  type="primary"
                  @click="openCustomerDetail(scope.row.customerId)"
                  class="customer-link"
                >
                  {{ scope.row.customerName }}
                </el-link>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" label="商机名称" prop="businessName" width="130">
            <template #default="scope">
              <div class="business-cell">
                <Icon icon="ep:opportunity" class="cell-icon" />
                <el-link
                  :underline="false"
                  type="primary"
                  @click="openBusinessDetail(scope.row.businessId)"
                  class="business-link"
                >
                  {{ scope.row.businessName }}
                </el-link>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            align="center"
            label="合同金额（元）"
            prop="totalPrice"
            width="160"
            :formatter="erpPriceTableColumnFormatter"
          >
            <template #default="scope">
              <div class="price-cell">
                <Icon icon="ep:money" class="cell-icon" />
                <span class="price-text">{{
                  erpPriceTableColumnFormatter(scope.row, null, scope.row.totalPrice)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            align="center"
            label="下单时间"
            prop="orderDate"
            width="120"
            :formatter="dateFormatter2"
          >
            <template #default="scope">
              <div class="date-cell">
                <Icon icon="ep:calendar" class="cell-icon" />
                <span class="date-text">{{
                  dateFormatter2(scope.row, null, scope.row.orderDate)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            align="center"
            label="合同开始时间"
            prop="startTime"
            width="140"
            :formatter="dateFormatter2"
          >
            <template #default="scope">
              <div class="date-cell">
                <Icon icon="ep:calendar" class="cell-icon" />
                <span class="date-text start-time">{{
                  dateFormatter2(scope.row, null, scope.row.startTime)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            align="center"
            label="合同结束时间"
            prop="endTime"
            width="140"
            :formatter="dateFormatter2"
          >
            <template #default="scope">
              <div class="date-cell">
                <Icon icon="ep:calendar" class="cell-icon" />
                <span class="date-text end-time">{{
                  dateFormatter2(scope.row, null, scope.row.endTime)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" label="客户签约人" prop="contactName" width="130">
            <template #default="scope">
              <div class="contact-cell">
                <Icon icon="ep:user-filled" class="cell-icon" />
                <el-link
                  :underline="false"
                  type="primary"
                  @click="openContactDetail(scope.row.signContactId)"
                  class="contact-link"
                >
                  {{ scope.row.signContactName }}
                </el-link>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" label="公司签约人" prop="signUserName" width="130">
            <template #default="scope">
              <div class="sign-user-cell">
                <Icon icon="ep:user-filled" class="cell-icon" />
                <span class="sign-user-text">{{ scope.row.signUserName }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" label="备注" prop="remark" width="200">
            <template #default="scope">
              <div class="remark-cell">
                <Icon icon="ep:document" class="cell-icon" />
                <span class="remark-text">{{ scope.row.remark }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            align="center"
            label="已回款金额（元）"
            prop="totalReceivablePrice"
            width="160"
            :formatter="erpPriceTableColumnFormatter"
          >
            <template #default="scope">
              <div class="price-cell">
                <Icon icon="ep:money" class="cell-icon" />
                <span class="received-price-text">{{
                  erpPriceTableColumnFormatter(scope.row, null, scope.row.totalReceivablePrice)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            align="center"
            label="未回款金额（元）"
            prop="totalReceivablePrice"
            width="160"
            :formatter="erpPriceTableColumnFormatter"
          >
            <template #default="scope">
              <div class="price-cell">
                <Icon icon="ep:money" class="cell-icon" />
                <span class="unpaid-price-text">{{
                  erpPriceInputFormatter(scope.row.totalPrice - scope.row.totalReceivablePrice)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            :formatter="dateFormatter"
            align="center"
            label="最后跟进时间"
            prop="contactLastTime"
            width="180px"
          >
            <template #default="scope">
              <div class="time-cell">
                <Icon icon="ep:clock" class="cell-icon" />
                <span class="time-text">{{
                  dateFormatter(scope.row, null, scope.row.contactLastTime)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" label="负责人" prop="ownerUserName" width="120">
            <template #default="scope">
              <div class="owner-cell">
                <Icon icon="ep:user-filled" class="cell-icon" />
                <span class="owner-text">{{ scope.row.ownerUserName }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" label="所属部门" prop="ownerUserDeptName" width="120">
            <template #default="scope">
              <div class="dept-cell">
                <Icon icon="ep:office-building" class="cell-icon" />
                <span class="dept-text">{{ scope.row.ownerUserDeptName }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            :formatter="dateFormatter"
            align="center"
            label="更新时间"
            prop="updateTime"
            width="180px"
          >
            <template #default="scope">
              <div class="time-cell">
                <Icon icon="ep:clock" class="cell-icon" />
                <span class="time-text">{{
                  dateFormatter(scope.row, null, scope.row.updateTime)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            :formatter="dateFormatter"
            align="center"
            label="创建时间"
            prop="createTime"
            width="180px"
          >
            <template #default="scope">
              <div class="time-cell">
                <Icon icon="ep:clock" class="cell-icon" />
                <span class="time-text">{{
                  dateFormatter(scope.row, null, scope.row.createTime)
                }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column align="center" label="创建人" prop="creatorName" width="120">
            <template #default="scope">
              <div class="creator-cell">
                <Icon icon="ep:user" class="cell-icon" />
                <span class="creator-text">{{ scope.row.creatorName }}</span>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            align="center"
            fixed="right"
            label="合同状态"
            prop="auditStatus"
            width="120"
          >
            <template #default="scope">
              <div class="status-cell">
                <Icon icon="ep:flag" class="cell-icon" />
                <dict-tag
                  :type="DICT_TYPE.CRM_AUDIT_STATUS"
                  :value="scope.row.auditStatus"
                  class="enhanced-tag"
                />
              </div>
            </template>
          </el-table-column>

          <el-table-column fixed="right" label="操作" width="90">
            <template #default="scope">
              <div class="action-cell">
                <el-button
                  link
                  v-hasPermi="['crm:contract:update']"
                  type="primary"
                  @click="handleProcessDetail(scope.row)"
                  class="action-button"
                >
                  <Icon icon="ep:view" class="btn-icon" />
                  查看审批
                </el-button>
              </div>
            </template>
          </el-table-column>
        </el-table>

        <!-- 分页 -->
        <div class="pagination-wrapper">
          <Pagination
            v-model:limit="queryParams.pageSize"
            v-model:page="queryParams.pageNo"
            :total="total"
            @pagination="getList"
          />
        </div>
      </div>
    </ContentWrap>

    <!-- 详情弹窗 -->
    <CrmSpec ref="crmSpec" @getPage="handleQuery" />
  </div>
</template>

<script setup lang="ts" name="EndContract">
import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
import * as ContractApi from '@/api/crm/contract'
import { fenToYuanFormat } from '@/utils/formatter'
import { DICT_TYPE } from '@/utils/dict'
import { CONTRACT_EXPIRY_TYPE } from './common'
import { erpPriceInputFormatter, erpPriceTableColumnFormatter } from '@/utils'

const crmSpec = ref(null)
const loading = ref(true) // 列表的加载中
const total = ref(0) // 列表的总页数
const list = ref([]) // 列表的数据
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  sceneType: '1', // 自己负责的
  expiryType: 1
})
const queryFormRef = ref() // 搜索的表单

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    const data = await ContractApi.getContractPage(queryParams)
    list.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}

/** 查看审批 */
const handleProcessDetail = (row: ContractApi.ContractVO) => {
  push({ name: 'BpmProcessInstanceDetail', query: { id: row.processInstanceId } })
}

/** 打开合同详情 */
const { push } = useRouter()
const openDetail = (id: number) => {
  const arrId = list.value.map((item) => item.id)
  crmSpec.value.setDrawer(true, 'contract', id, arrId)
}

/** 打开客户详情 */
const openCustomerDetail = (id: number) => {
  crmSpec.value.setDrawer(true, 'customer', id, [])
}

/** 打开联系人详情 */
const openContactDetail = (id: number) => {
  crmSpec.value.setDrawer(true, 'contact', id, [])
}

/** 打开商机详情 */
const openBusinessDetail = (id: number) => {
  crmSpec.value.setDrawer(true, 'business', id, [])
}

/** 激活时 */
onActivated(async () => {
  await getList()
})

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>

<style lang="scss" scoped>
// 主题色变量
$primary-color: #0052cc;
$primary-light: rgba(0, 82, 204, 0.1);
$primary-border: rgba(0, 82, 204, 0.3);
$success-color: #67c23a;
$warning-color: #e6a23c;
$danger-color: #f56c6c;
$info-color: #909399;
$text-primary: #303133;
$text-regular: #606266;
$text-secondary: #909399;
$text-placeholder: #c0c4cc;
$border-color: #dcdfe6;
$border-light: #e4e7ed;
$bg-color: #f5f7fa;
$shadow-light: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
$shadow-base:
  0 2px 4px rgba(0, 0, 0, 0.12),
  0 0 6px rgba(0, 0, 0, 0.04);
$border-radius: 12px;
$border-radius-small: 8px;

.contract-remind-container {
  padding: 0;
  background: $bg-color;

  @media (max-width: 768px) {
    padding: 0;
  }
}

/* 搜索区域样式 */
.search-wrapper {
  margin-bottom: 16px;
  border-radius: $border-radius;
  overflow: hidden;
  box-shadow: $shadow-light;
  border: 1px solid $border-light;

  :deep(.el-card__body) {
    padding: 0;
  }
}

.search-header {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, $primary-color 0%, #1d4ed8 100%);
  color: white;

  @media (max-width: 768px) {
    padding: 16px 20px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

.header-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: $border-radius-small;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;

  @media (max-width: 768px) {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

.header-content {
  flex: 1;
  margin-left: 12px;

  @media (max-width: 768px) {
    margin-left: 0;
  }
}

.search-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;

  @media (max-width: 768px) {
    font-size: 16px;
  }
}

.search-subtitle {
  font-size: 13px;
  opacity: 0.9;
  margin: 0;

  @media (max-width: 768px) {
    font-size: 12px;
  }
}

.search-form-container {
  padding: 24px;
  background: white;

  @media (max-width: 768px) {
    padding: 16px;
  }
}

.enhanced-search-form {
  .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;

    @media (max-width: 768px) {
      flex-direction: column;
      gap: 12px;
      margin-bottom: 16px;
    }
  }

  .form-item {
    flex: 1;
    min-width: 260px;
    margin-bottom: 0;

    @media (max-width: 768px) {
      min-width: auto;
      flex: none;
    }

    :deep(.el-form-item__label) {
      font-weight: 600;
      color: $text-regular;
      padding-bottom: 8px;

      @media (max-width: 768px) {
        font-size: 14px;
        width: 100% !important;
        text-align: left !important;
        margin-bottom: 8px;
      }
    }

    :deep(.el-form-item__content) {
      @media (max-width: 768px) {
        margin-left: 0 !important;
      }
    }
  }

  // H5适配：表单项垂直布局
  @media (max-width: 768px) {
    :deep(.el-form-item) {
      display: block;
    }
  }
}

/* 选择器样式 */
.enhanced-select {
  width: 100%;

  :deep(.el-select__wrapper) {
    border-radius: $border-radius-small;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    padding: 8px 16px;

    &:hover {
      box-shadow: 0 4px 12px rgba(0, 82, 204, 0.1);
    }

    &.is-focused {
      box-shadow: 0 4px 12px rgba(0, 82, 204, 0.2);
      border-color: $primary-color;
    }
  }
}

/* 选项样式 */
.option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.option-icon {
  font-size: 14px;
  color: $primary-color;
}

/* 表格区域样式 */
.table-wrapper {
  border-radius: $border-radius;
  overflow: hidden;
  box-shadow: $shadow-light;
  border: 1px solid $border-light;

  :deep(.el-card__body) {
    padding: 0;
  }
}

.table-header {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, $primary-color 0%, #1d4ed8 100%);
  color: white;

  @media (max-width: 768px) {
    padding: 16px 20px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

.table-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;

  @media (max-width: 768px) {
    font-size: 16px;
  }
}

.table-subtitle {
  font-size: 13px;
  opacity: 0.9;
  margin: 0;

  @media (max-width: 768px) {
    font-size: 12px;
  }
}

.table-container {
  background: white;
  overflow-x: auto;
}

.enhanced-table {
  :deep(.el-table__header) {
    th {
      background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%) !important;
      color: $text-primary !important;
      font-weight: 600 !important;
      border-bottom: 2px solid $primary-light;
      padding: 16px 12px;
    }
  }

  :deep(.el-table__body) {
    tr {
      transition: all 0.3s ease;

      &:hover {
        background: $primary-light !important;
      }

      td {
        padding: 14px 12px;
        border-bottom: 1px solid $border-light;
      }
    }

    .el-table__row--striped {
      background: #fafbff;

      &:hover {
        background: $primary-light !important;
      }
    }
  }

  // H5适配
  @media (max-width: 768px) {
    :deep(.el-table__header) th {
      padding: 12px 8px;
      font-size: 13px;
    }

    :deep(.el-table__body) td {
      padding: 12px 8px;
      font-size: 12px;
    }
  }
}

/* 表格单元格样式 */
.contract-no-cell,
.name-cell,
.customer-cell,
.business-cell,
.price-cell,
.date-cell,
.contact-cell,
.sign-user-cell,
.remark-cell,
.time-cell,
.owner-cell,
.dept-cell,
.creator-cell,
.status-cell,
.action-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.cell-icon {
  font-size: 14px;
  flex-shrink: 0;
  color: $primary-color;
}

.contract-no-text {
  color: $primary-color;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  background: $primary-light;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;

  @media (max-width: 768px) {
    font-size: 11px;
    padding: 1px 4px;
  }
}

.contract-link,
.customer-link,
.business-link,
.contact-link {
  color: $primary-color;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;

  &:hover {
    color: #1d4ed8;
    text-shadow: 0 1px 3px rgba(0, 82, 204, 0.3);
  }

  @media (max-width: 768px) {
    font-size: 12px;
  }
}

.price-text {
  color: $danger-color;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  background: rgba(245, 108, 108, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;

  @media (max-width: 768px) {
    font-size: 11px;
    padding: 1px 4px;
  }
}

.received-price-text {
  color: $success-color;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  background: rgba(103, 194, 58, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;

  @media (max-width: 768px) {
    font-size: 11px;
    padding: 1px 4px;
  }
}

.unpaid-price-text {
  color: $warning-color;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  background: rgba(230, 162, 60, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;

  @media (max-width: 768px) {
    font-size: 11px;
    padding: 1px 4px;
  }
}

.date-text {
  color: $info-color;
  font-weight: 500;
  font-family: 'Courier New', monospace;
  background: rgba(144, 147, 153, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;

  &.start-time {
    color: $success-color;
    background: rgba(103, 194, 58, 0.1);
  }

  &.end-time {
    color: $warning-color;
    background: rgba(230, 162, 60, 0.1);
  }

  @media (max-width: 768px) {
    font-size: 11px;
    padding: 1px 4px;
  }
}

.time-text {
  color: $info-color;
  font-weight: 500;
  font-family: 'Courier New', monospace;
  background: rgba(144, 147, 153, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;

  @media (max-width: 768px) {
    font-size: 11px;
    padding: 1px 4px;
  }
}

.sign-user-text,
.owner-text,
.dept-text,
.creator-text {
  color: $text-regular;
  font-weight: 500;
  font-size: 12px;

  @media (max-width: 768px) {
    font-size: 11px;
  }
}

.remark-text {
  color: $text-secondary;
  font-size: 12px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  @media (max-width: 768px) {
    max-width: 100px;
    font-size: 11px;
  }
}

/* 标签样式 */
.enhanced-tag {
  border-radius: 6px;
  font-weight: 500;
  padding: 4px 8px;
  font-size: 12px;
  border: none;
  box-shadow: $shadow-base;

  @media (max-width: 768px) {
    font-size: 11px;
    padding: 3px 6px;
  }
}

/* 操作按钮 */
.action-button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;

  &:hover {
    transform: scale(1.05);
    background: rgba(0, 82, 204, 0.1);
    color: $primary-color;
  }

  .btn-icon {
    font-size: 12px;
  }

  @media (max-width: 768px) {
    padding: 4px 8px;
    font-size: 11px;
    width: 100%;
    justify-content: center;
  }
}

/* 分页样式 */
.pagination-wrapper {
  display: flex;
  justify-content: center;
  padding: 20px 24px;
  background: white;
  border-top: 1px solid $border-light;

  @media (max-width: 768px) {
    padding: 16px 20px;
  }

  :deep(.el-pagination) {
    .el-pager li {
      border-radius: 6px;
      margin: 0 2px;
      transition: all 0.3s ease;

      &:hover {
        background: $primary-light;
        color: $primary-color;
      }

      &.is-active {
        background: $primary-color;
        color: white;
      }
    }

    .btn-prev,
    .btn-next {
      border-radius: 6px;
      transition: all 0.3s ease;

      &:hover {
        background: $primary-light;
        color: $primary-color;
      }
    }

    @media (max-width: 768px) {
      .el-pagination__sizes,
      .el-pagination__jump {
        display: none;
      }
    }
  }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
  .contract-remind-container {
    background: #1f2937;
  }

  .search-wrapper,
  .table-wrapper {
    background: #374151;
    border-color: #4b5563;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .search-form-container,
  .table-container,
  .pagination-wrapper {
    background: #374151;
  }

  .search-title,
  .table-title {
    color: #f9fafb;
  }

  .contract-no-text {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
  }

  .contract-link,
  .customer-link,
  .business-link,
  .contact-link {
    color: #60a5fa;

    &:hover {
      color: #93c5fd;
    }
  }

  .price-text {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
  }

  .received-price-text {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
  }

  .unpaid-price-text {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
  }

  .date-text,
  .time-text {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;

    &.start-time {
      background: rgba(52, 211, 153, 0.1);
      color: #34d399;
    }

    &.end-time {
      background: rgba(251, 191, 36, 0.1);
      color: #fbbf24;
    }
  }

  .sign-user-text,
  .owner-text,
  .dept-text,
  .creator-text {
    color: #f9fafb;
  }

  .remark-text {
    color: #d1d5db;
  }

  .enhanced-table {
    :deep(.el-table__header) {
      th {
        background: #4b5563 !important;
        color: #f9fafb !important;
        border-bottom-color: #6b7280;
      }
    }

    :deep(.el-table__cell) {
      border-bottom-color: #4b5563;
    }
  }

  .enhanced-select {
    :deep(.el-select__wrapper) {
      background: #4b5563;
      border-color: #6b7280;

      .el-select__placeholder {
        color: #9ca3af;
      }
    }
  }
}

/* 响应式优化 */
@media (max-width: 480px) {
  .search-header,
  .table-header {
    padding: 12px 16px;
  }

  .search-form-container {
    padding: 12px;
  }

  .pagination-wrapper {
    padding: 12px 16px;
  }

  .enhanced-table {
    :deep(.el-table__header) th {
      padding: 10px 6px;
      font-size: 12px;
    }

    :deep(.el-table__body) td {
      padding: 10px 6px;
      font-size: 11px;
    }
  }

  .contract-no-text,
  .price-text,
  .received-price-text,
  .unpaid-price-text,
  .date-text,
  .time-text {
    font-size: 10px;
  }

  .contract-link,
  .customer-link,
  .business-link,
  .contact-link {
    font-size: 11px;
  }

  .sign-user-text,
  .owner-text,
  .dept-text,
  .creator-text {
    font-size: 10px;
  }

  .remark-text {
    max-width: 80px;
    font-size: 10px;
  }

  .action-button {
    padding: 3px 6px;
    font-size: 10px;
  }

  .enhanced-tag {
    font-size: 10px;
    padding: 2px 4px;
  }
}
</style>
